package com.sjgtw.cloud.web.freezeInjuryPlan.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.sjgtw.cloud.common.core.web.controller.BaseController;
import com.sjgtw.cloud.common.core.web.domain.AjaxResult;
import com.sjgtw.cloud.common.core.web.page.TableDataInfo;
import com.sjgtw.cloud.web.freezeInjuryPlan.domain.FreezeInjuryPlan;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sjgtw.cloud.web.freezeInjuryPlan.service.IFreezeInjuryPlanService;

/**
 * 应急处置方案Controller
 * 
 * @author ruoyi
 * @date 2024-03-16
 */
@RestController
@Api(tags="1.13、应急处置方案")
@RequestMapping("/freezeInjuryPlan")
public class FreezeInjuryPlanController extends BaseController
{
    @Autowired
    private IFreezeInjuryPlanService freezeInjuryPlanService;

    /**
     * 查询应急处置方案列表
     */

    @GetMapping("/list")
    @ApiOperation("列表")
    public TableDataInfo list(FreezeInjuryPlan freezeInjuryPlan)
    {
        startPage();
        List<FreezeInjuryPlan> list = freezeInjuryPlanService.selectFreezeInjuryPlanList(freezeInjuryPlan);
        return getDataTable(list);
    }

    /**
     * 导出应急处置方案列表
     */
    /*@RequiresPermissions("system:plan:export")
    @Log(title = "应急处置方案", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FreezeInjuryPlan freezeInjuryPlan)
    {
        List<FreezeInjuryPlan> list = freezeInjuryPlanService.selectFreezeInjuryPlanList(freezeInjuryPlan);
        ExcelUtil<FreezeInjuryPlan> util = new ExcelUtil<FreezeInjuryPlan>(FreezeInjuryPlan.class);
        util.exportExcel(response, list, "应急处置方案数据");
    }*/

    /**
     * 获取应急处置方案详细信息
     */

    @GetMapping(value = "/getInfo/{id}")
    @ApiOperation("获取详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(freezeInjuryPlanService.selectFreezeInjuryPlanById(id));
    }

    /**
     * 新增应急处置方案
     */

    @PostMapping("/add")
    @ApiOperation("新增")
    public AjaxResult add(@RequestBody FreezeInjuryPlan freezeInjuryPlan)
    {
        return toAjax(freezeInjuryPlanService.insertFreezeInjuryPlan(freezeInjuryPlan));
    }

    /**
     * 修改应急处置方案
     */

    @PutMapping("/edit")
    @ApiOperation("修改")
    public AjaxResult edit(@RequestBody FreezeInjuryPlan freezeInjuryPlan)
    {
        return toAjax(freezeInjuryPlanService.updateFreezeInjuryPlan(freezeInjuryPlan));
    }

    /**
     * 删除应急处置方案
     */

	@DeleteMapping("/delete/{id}")
    @ApiOperation("删除")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(freezeInjuryPlanService.deleteFreezeInjuryPlanById(id));
    }
}
